{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\Desktop\\simple\\text.pdf\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import win32com\n",
    "from win32com.client import Dispatch, constants  \n",
    "def transfer(path1,type1):\n",
    "    w = win32com.client.Dispatch('Word.Application')\n",
    "    w.Visible = 0\n",
    "    w.DisplayAlerts = 0\n",
    "    doc = w.Documents.Open(path1)\n",
    "    x,y = os.path.splitext(path1)\n",
    "    doc.SaveAs(r'x+type1')\n",
    "    print(x+type1)\n",
    "    doc.Close()\n",
    "    w.Quit()   \n",
    "transfer(r'C:\\Users\\Administrator\\Desktop\\simple\\text.doc','.pdf')\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "570feb405e2e27c949193ac68f46852414290d515b0ba6e5d90d076ed2284471"
  },
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
